import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RegionVO, RegionForm, RegionQuery } from '@/api/zntx-app/region/types';

/**
 * 查询工位管理列表
 * @param query
 * @returns {*}
 */

export const listRegion = (query?: RegionQuery): AxiosPromise<RegionVO[]> => {
  return request({
    url: '/zntx-app/region/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询工位管理详细
 * @param id
 */
export const getRegion = (id: string | number): AxiosPromise<RegionVO> => {
  return request({
    url: '/zntx-app/region/' + id,
    method: 'get'
  });
};

/**
 * 新增工位管理
 * @param data
 */
export const addRegion = (data: RegionForm) => {
  return request({
    url: '/zntx-app/region',
    method: 'post',
    data: data
  });
};

/**
 * 修改工位管理
 * @param data
 */
export const updateRegion = (data: RegionForm) => {
  return request({
    url: '/zntx-app/region',
    method: 'put',
    data: data
  });
};

/**
 * 删除工位管理
 * @param id
 */
export const delRegion = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zntx-app/region/' + id,
    method: 'delete'
  });
};
